package com.google.code.drift.utils;

import android.content.Context;
import android.media.MediaPlayer;

/**
 * 音频控制类。比如，播放、释放
 * 
 * @author zkwlx
 * 
 */
public class AudioUtils {

	MediaPlayer mPlayer;

	public AudioUtils(Context context, int resId) {

		mPlayer = MediaPlayer.create(context, resId);

	}

	public void play() {
		if (mPlayer.isPlaying()) {
			return;
		}
		if (mPlayer != null) {
			mPlayer.start();
		}
	}

	public void release() {
		if (mPlayer != null) {
			mPlayer.release();
			mPlayer = null;
		}
	}

}
